#include "Tile.h"
#include "RenderManager.h"

Tile::Tile(unsigned short tileSize, const sf::Vector2f& position, sf::Texture& tile, short type)
{
	_base.setTexture(tile);
	_base.setTextureRect(sf::IntRect(0, 0, tileSize, tileSize));
	_position = sf::Vector2f(position.x, position.y);
	_base.setPosition(position.x, position.y);
	_tileSize = tileSize;
	_type = type;
}

unsigned short Tile::_tileSize = 0;

Tile::~Tile(void){}

void Tile::draw(RenderManager* renderManager)
{
	renderManager->draw(_base);
	/*if (!_walkable)
	{
		sf::RectangleShape rect(sf::Vector2f(32.0f, 32.0f));
		rect.setPosition(_base.getPosition());
		rect.setFillColor(sf::Color::Blue);
		renderManager->draw(rect);
	}*/
}

sf::FloatRect Tile::collisionBox()
{
	float x = _base.getPosition().x;
	float y = _base.getPosition().y;
	return sf::FloatRect(_base.getPosition().x, _base.getPosition().y, static_cast<float>(_tileSize), static_cast<float>(_tileSize));
}